package com.imti.mall.product.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.imti.mall.model.pms.pojo.PmsSkuStock;
import com.imti.mall.product.mapper.PmsSkuStockDynaSqlProvider;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.UpdateProvider;

import java.util.List;


@Mapper
public interface PmsSkuStockDao extends BaseMapper<PmsSkuStock> {
    /**
     * 根据商品id查询SKU数据
     * @param id
     * @return
     */
    @Select("select * from pms_sku_stock where product_id=#{id}")
    public List<PmsSkuStock> getPmsSkuStockproductProductId(Integer id);

    /**
     * 根据商品id和SKU编号查询SKU数据
     * @param id
     * @return
     */
    @Select("select * from pms_sku_stock where product_id=#{id} and sku_code=#{skuCode}")
    public PmsSkuStock getPmsSkuStockproductProductSkuCode(Integer id,String skuCode);


    /**
     * 修改SKU信息
     * @param pmsSkuStock
     * @return
     */
    @UpdateProvider(type = PmsSkuStockDynaSqlProvider.class, method ="updateSkuStockById")
    public Integer updateSkuStockBy(PmsSkuStock pmsSkuStock);
}